package simple.form.controller;

import com.alibaba.fastjson.JSON;

import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


/**
 * 返回
 * Created by Administrator on 2017/2/24.
 */
public class Response {



    private HttpServletResponse response;
    private String  responseResult;
    public Response(ServletResponse response) {
        this.response = (HttpServletResponse) response;
    }

    public void response(String responseResult) throws IOException {
        this.responseResult = responseResult;
        response.getWriter().write(responseResult);
    }

    public void response(JSON responseJSon) throws IOException {
        this.responseResult = responseJSon.toJSONString();
        response.getWriter().write(responseResult);
    }


    public String getResponseResult() {
        return responseResult;
    }

    public void setResponseResult(String responseResult) {
        this.responseResult = responseResult;
    }

    public HttpServletResponse getResponse() {
        return response;
    }

    public void setResponse(HttpServletResponse response) {
        this.response = response;
    }
}
